﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace UrlsAndRoutes.Controllers
{
    [RoutePrefix("users")]
    public class CustomerController : Controller
    {
        // GET: Customer
        [Route("~/Test")]
        public ActionResult Index()
        {
            ViewBag.Controller = "Customer";
            ViewBag.Action = "Index";
            return View("ActionName");
        }
        [Route("add/{user}/{id:int}")]
        public string Create(string user,int id)
        {
           
            return $"User:{user},ID:{id}";
        }
        [Route("add/{user}/{password:alpha:length(6)}")]
        public string ChangePassword(string user, string password)
        {

            return $"User:{user},password:{password}";
        }

        public ActionResult List()
        {
            ViewBag.Controller = "Customer";
            ViewBag.Action = "List";
            return View("ActionName");
        }

        public ActionResult CustomVariable(int customerid)
        {
            ViewBag.Controller = "Customer";
            ViewBag.Action = "CustomVariable";
            ViewBag.CustomVariable = RouteData.Values["customerid"];
            return View("ActionName");
        }
    }
}